﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ParaEditor.Infrastructure
{
    /// <summary>
    /// 返回Profile.ini配置参数
    /// </summary>
    public class Profile
    {
        private static ConfigureFile ReadConfigureFile = new ConfigureFile(".\\Profile.ini");

        /// <summary>
        /// 返回数据库服务名
        /// </summary>
        /// <returns></returns>
        public static string getServerName()
        {
            return ReadConfigureFile.ReadConfigureFileValue("DataBase", "ServerName");
        }

        
        /// <summary>
        /// 返回登陆账户
        /// </summary>
        /// <returns></returns>
        public static string getLogId()
        {
            return ReadConfigureFile.ReadConfigureFileValue("DataBase", "LogId");
        }
        /// <summary>
        /// 返回登陆密码
        /// </summary>
        /// <returns></returns>
        public static string getPassWord()
        {
            return ReadConfigureFile.ReadConfigureFileValue("DataBase", "PassWord");
        }
        /// <summary>
        /// 返回车站编码
        /// </summary>
        /// <returns></returns>
        public static string getSendStationCode()
        {
            return ReadConfigureFile.ReadConfigureFileValue("DataBase", "SendStationCode");
        }
        /// <summary>
        /// 返回线路代码
        /// </summary>
        /// <returns></returns>
        public static String getLineCode()
        {
            return ReadConfigureFile.ReadConfigureFileValue("DataBase", "LineCode");

        }
        /// <summary>
        /// 返回服务端口
        /// </summary>
        /// <returns></returns>
        public static string getServerPort()
        {
            return ReadConfigureFile.ReadConfigureFileValue("DataBase", "ServerPort");
        }

        public static string getPrintHeader()
        {
            return ReadConfigureFile.ReadConfigureFileValue("DataBase", "PrintHeader");
        }
        public static string getPrintTail()
        {
            return ReadConfigureFile.ReadConfigureFileValue("DataBase", "PrintTail");
        }
        /// <summary>
        /// 返回线路ID
        /// </summary>
        /// <returns></returns>
        public static int getLineID()
        {
            String lineID = ReadConfigureFile.ReadConfigureFileValue("SERVER", "LineID");
            return int.Parse(lineID);

        }
        /// <summary>
        /// 返回线路NID
        /// </summary>
        /// <returns></returns>
        public static string getLineNID()
        {
            return ReadConfigureFile.ReadConfigureFileValue("SERVER", "LineNID");
        }
        /// <summary>
        /// 返回线路名称
        /// </summary>
        /// <returns></returns>
        public static string getLineName()
        {
            return ReadConfigureFile.ReadConfigureFileValue("SERVER", "LineName");
        }
        /// <summary>
        /// 返回车站ID
        /// </summary>
        /// <returns></returns>
        public static string getStationID()
        {
            return ReadConfigureFile.ReadConfigureFileValue("SERVER", "StationID");
        }
        /// <summary>
        /// 返回车站数量
        /// </summary>
        /// <returns></returns>
        public static string getStationNum()
        {
            return ReadConfigureFile.ReadConfigureFileValue("SERVER", "StationNum");
        }

        /// <summary>
        /// 返回读卡器COM口编号
        /// </summary>
        /// <returns></returns>
        public static string getComPort()
        {
            return ReadConfigureFile.ReadConfigureFileValue("CARDREADER", "COMPORT");
        }

        public static string getEquipID()
        {
            return ReadConfigureFile.ReadConfigureFileValue("CARDREADER", "EQUIP_ID");
        }

        /// <summary>
        /// 获取余额最大上限
        /// </summary>
        /// <returns></returns>
        public static int getMaxBalence()
        {
            string s;
            int result;
            try
            {
                s = ReadConfigureFile.ReadConfigureFileValue("BALENCE", "MAXBALENCE");
                result = Convert.ToInt32(s);
            }
            catch(Exception e)
            {
                result = 300;
            }

            return result;
        }

        public static string getSupplierID()
        {
            return ReadConfigureFile.ReadConfigureFileValue("SUPPLIER", "SUPPLIERID");
        }

        public static string getCentreIP()
        {
            return ReadConfigureFile.ReadConfigureFileValue("CENTRE", "CENTRE_IP");
        }

        public static int getCentrePort()
        {
            string str = ReadConfigureFile.ReadConfigureFileValue("CENTRE", "CENTRE_PORT");
            return int.Parse(str);
        }

        public static string GetLocalIP()
        {
            return ReadConfigureFile.ReadConfigureFileValue("SYSSETTING", "CENTRE_IP");
        }

        public static string GetLocalPort()
        {
            return ReadConfigureFile.ReadConfigureFileValue("SYSSETTING", "CENTRE_PORT");
        }
    }
}
